<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>picasa.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="closure_goog_useragent_picasa.js.html">picasa.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Copyright 2007 The Closure Library Authors. All Rights Reserved.
<a name="line2"></a>//
<a name="line3"></a>// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<a name="line4"></a>// you may not use this file except in compliance with the License.
<a name="line5"></a>// You may obtain a copy of the License at
<a name="line6"></a>//
<a name="line7"></a>//      http://www.apache.org/licenses/LICENSE-2.0
<a name="line8"></a>//
<a name="line9"></a>// Unless required by applicable law or agreed to in writing, software
<a name="line10"></a>// distributed under the License is distributed on an &quot;AS-IS&quot; BASIS,
<a name="line11"></a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a name="line12"></a>// See the License for the specific language governing permissions and
<a name="line13"></a>// limitations under the License.
<a name="line14"></a>
<a name="line15"></a>/**
<a name="line16"></a> * @fileoverview Detection for whether the user has Picasa installed.
<a name="line17"></a> * Only Picasa versions 2 and later can be detected, and only from Firefox or
<a name="line18"></a> * Internet Explorer. Picasa for Linux cannot be detected.
<a name="line19"></a> *
<a name="line20"></a> * In the future, Picasa may provide access to the installed version number,
<a name="line21"></a> * but until then we can only detect that Picasa 2 or later is present.
<a name="line22"></a> *
<a name="line23"></a> * To check for Picasa on Internet Explorer requires using document.write, so
<a name="line24"></a> * this file must be included at page rendering time and cannot be imported
<a name="line25"></a> * later as part of a dynamically loaded module.
<a name="line26"></a> *
<a name="line27"></a> * @author brenneman@google.com (Shawn Brenneman)
<a name="line28"></a> * @see ../demos/useragent.html
<a name="line29"></a> */
<a name="line30"></a>
<a name="line31"></a>
<a name="line32"></a>goog.provide(&#39;goog.userAgent.picasa&#39;);
<a name="line33"></a>
<a name="line34"></a>goog.require(&#39;goog.string&#39;);
<a name="line35"></a>goog.require(&#39;goog.userAgent&#39;);
<a name="line36"></a>
<a name="line37"></a>
<a name="line38"></a>/**
<a name="line39"></a> * Variable name used to temporarily save the Picasa state in the global object
<a name="line40"></a> * in Internet Explorer.
<a name="line41"></a> * @type {string}
<a name="line42"></a> * @private
<a name="line43"></a> */
<a name="line44"></a>goog.userAgent.picasa.IE_HAS_PICASA_ = &#39;hasPicasa&#39;;
<a name="line45"></a>
<a name="line46"></a>
<a name="line47"></a>(function() {
<a name="line48"></a>  var hasPicasa = false;
<a name="line49"></a>
<a name="line50"></a>  if (goog.userAgent.IE) {
<a name="line51"></a>    // In Internet Explorer, Picasa 2 can be detected using conditional comments
<a name="line52"></a>    // due to some nice registry magic. The precise version number is not
<a name="line53"></a>    // available, only the major version. This may be updated for Picasa 3. This
<a name="line54"></a>    // check must pollute the global namespace.
<a name="line55"></a>    goog.global[goog.userAgent.picasa.IE_HAS_PICASA_] = hasPicasa;
<a name="line56"></a>
<a name="line57"></a>    // NOTE(user): Some browsers do not like seeing
<a name="line58"></a>    // slash-script anywhere in the text even if it&#39;s inside a string
<a name="line59"></a>    // and escaped with a backslash, make a string in a way that
<a name="line60"></a>    // avoids problems.
<a name="line61"></a>
<a name="line62"></a>    document.write(goog.string.subs(
<a name="line63"></a>        &#39;&lt;!--[if gte Picasa 2]&gt;&#39; +
<a name="line64"></a>        &#39;&lt;%s&gt;&#39; +
<a name="line65"></a>        &#39;this.%s=true;&#39; +
<a name="line66"></a>        &#39;&lt;/%s&gt;&#39; +
<a name="line67"></a>        &#39;&lt;![endif]--&gt;&#39;,
<a name="line68"></a>        &#39;script&#39;, goog.userAgent.picasa.IE_HAS_PICASA_, &#39;script&#39;));
<a name="line69"></a>
<a name="line70"></a>    hasPicasa = goog.global[goog.userAgent.picasa.IE_HAS_PICASA_];
<a name="line71"></a>
<a name="line72"></a>    // Unset the variable in a crude attempt to leave no trace.
<a name="line73"></a>    goog.global[goog.userAgent.picasa.IE_HAS_PICASA_] = undefined;
<a name="line74"></a>
<a name="line75"></a>  } else if (navigator.mimeTypes &amp;&amp;
<a name="line76"></a>             navigator.mimeTypes[&#39;application/x-picasa-detect&#39;]) {
<a name="line77"></a>    // Picasa 2.x registers a file handler for the MIME-type
<a name="line78"></a>    // &#39;application/x-picasa-detect&#39; for detection in Firefox. Future versions
<a name="line79"></a>    // may make precise version detection possible.
<a name="line80"></a>    hasPicasa = true;
<a name="line81"></a>  }
<a name="line82"></a>
<a name="line83"></a>  /**
<a name="line84"></a>   * Whether we detect the user has Picasa installed.
<a name="line85"></a>   * @type {boolean}
<a name="line86"></a>   */
<a name="line87"></a>  goog.userAgent.picasa.HAS_PICASA = hasPicasa;
<a name="line88"></a>
<a name="line89"></a>
<a name="line90"></a>  /**
<a name="line91"></a>   * The installed version of Picasa. If Picasa is detected, this means it is
<a name="line92"></a>   * version 2 or later. The precise version number is not yet available to the
<a name="line93"></a>   * browser, this is a placeholder for later versions of Picasa.
<a name="line94"></a>   * @type {string}
<a name="line95"></a>   */
<a name="line96"></a>  goog.userAgent.picasa.VERSION = hasPicasa ? &#39;2&#39; : &#39;&#39;;
<a name="line97"></a>
<a name="line98"></a>})();
<a name="line99"></a>
<a name="line100"></a>
<a name="line101"></a>/**
<a name="line102"></a> * Whether the installed Picasa version is as new or newer than a given version.
<a name="line103"></a> * This is not yet relevant, we can&#39;t detect the true Picasa version number yet,
<a name="line104"></a> * but this may be possible in future Picasa releases.
<a name="line105"></a> * @param {string} version The version to check.
<a name="line106"></a> * @return {boolean} Whether the installed Picasa version is as new or newer
<a name="line107"></a> *     than a given version.
<a name="line108"></a> */
<a name="line109"></a>goog.userAgent.picasa.isVersion = function(version) {
<a name="line110"></a>  return goog.string.compareVersions(
<a name="line111"></a>      goog.userAgent.picasa.VERSION, version) &gt;= 0;
<a name="line112"></a>};
</pre>


</body>
</html>
